{template header member}		
<script type="text/javascript" src="{__ROOT__}statics/js/haidao.validate.js?v={HD_VERSION}"></script>
<link type="text/css" rel="stylesheet" href="{__ROOT__}statics/js/upload/uploader.css?v={HD_VERSION}" />
<script type="text/javascript" src="{__ROOT__}statics/js/upload/uploader.js?v={HD_VERSION}"></script>
		<div class="margin-big-top layout">
			<div class="container border border-gray-white member clearfix">
				<div class="left padding-big">
					<div class="user-head margin-big-left margin-big-top">
						<img src="<?php echo $this->member['avatar'];?>" height="148" />
						<span><a href="{url('member/account/avatar')}">修改头像</a></span>
					</div>
					<div class="margin-top text-center text-default"><p><?php echo $this->member['_group']['name'] ?></p></div>
					{template menu_index member}
				</div>
				<div class="right padding-top">
					<div class="margin-big-top margin-large-left padding-left process clearfix">
						<!--退货退款 开始-->
						{if !$_GET['type']}
						<ul class="margin-big-left">
							<li class="process-list proce-right all">
								<div class="proce"></div>
								<div class="node">
									<div class="item">
										<span class="text-drak-grey">买家申请退货退款</span>
									</div>
								</div>
							</li>
							<li class="process-list">
								<div class="proce"></div>
								<div class="node">
									<div class="item">
										<span class="text-drak-grey">卖家处理退货申请</span>
									</div>
								</div>
							</li>
							<li class="process-list">
								<div class="proce"></div>
								<div class="node">
									<div class="item">
										<span class="text-drak-grey">买家退货给卖家</span>
									</div>
								</div>
							</li>
							<li class="process-list proce-left">
								<div class="proce"></div>
								<div class="node">
									<div class="item">
										<span class="text-drak-grey">卖家确认收货，退款完成</span>
									</div>
								</div>
							</li>
						</ul>
						{/if}
						<!--退货退款 结束-->
						<!--仅退款 开始-->
						{if $_GET['type'] == 'refund' || $refund}
						<ul class="margin-big-left">
							<li class="process-list proce-right all">
								<div class="proce"></div>
								<div class="node">
									<div class="item">
										<span class="text-drak-grey">买家申请仅退款</span>
									</div>
								</div>
							</li>
							<li class="process-list">
								<div class="proce"></div>
								<div class="node">
									<div class="item">
										<span class="text-drak-grey">卖家处理退货申请</span>
									</div>
								</div>
							</li>
							<li class="process-list proce-left">
								<div class="proce"></div>
								<div class="node">
									<div class="item">
										<span class="text-drak-grey">退款完成</span>
									</div>
								</div>
							</li>
						</ul>
						{/if}
						<!--仅退款 结束-->
					</div>
					<div class="padding-top padding-big-left padding-big-right padding-big-bottom clearfix">
						<dl class="settlement-lists layout padding-none">
							<dt>选择售后方式：</dt>
							<dd class="item-checked">
								<div class="item {if !$_GET['type']}selected{/if}" data-id="return">
									<i></i>
									<a href="{url('return_refund',array('id'=>$_GET['id']))}">退货退款</a>
								</div>
								<div class="item {if $_GET['type'] == 'refund'}selected{/if}" data-id="refund">
									<i></i>
									<a href="{url('return_refund',array('id'=>$_GET['id'],'type' => 'refund'))}">仅退款</a>
								</div>
							</dd>
						</dl>
					</div>
					<div class="margin-big-left margin-big-right margin-big-bottom tabs-scroll">
						<div class="border border-sub padding-big bg-blue-gray">
							<form class="double-line clearfix" {if $_GET['type'] == 'refund'}action="{url('ajax_refund')}"{else}action="{url('ajax_return')}"{/if} method="post" name="ajax_return">
								<div class="list">
									<span class="label">退货退款原因：</span>
									<div class="content">
										<select name="cause">
											<option value="">请选择退货退款原因</option>
											<option value="外观/参数等与描述不符">外观/参数等与描述不符</option>
											<option value="商品发错货">商品发错货</option>
											<option value="产品质量/故障">产品质量/故障</option>
											<option value="效果不好或不喜欢">效果不好或不喜欢</option>
											<option value="收到商品少件/破损/污渍">收到商品少件/破损/污渍</option>
											<option value="假冒商品">假冒商品</option>
											<option value="其他">其他</option>
										</select>
									</div>
								</div>
								<div class="list">
									<span class="label">退款金额：</span>
									<div class="content">
										<input class="input" type="text" name="amount"/>
										最多可退款金额：<span class="text-mix">{$price}</span>
									</div>
								</div>
								<div class="list">
									<span class="label">原因：</span>
									<div class="content">
										<textarea class="textarea layout" name="desc" placeholder="请说明详细原因"></textarea>
									</div>
								</div>
								<div class="list">
									<span class="label">上传凭证：</span>
									<div class="content">
										<ul class="pic-rank-1 ul_return">
											<li class="add show">
												<label class="layout show" style="position: relative; height:100%;cursor: pointer;">
													<div id="add_return"></div>
												</label>
											</li>
										</ul>
									</div>
								</div>
								<div class="list">
									<span class="label"></span>
									<div class="content">
										<input type="hidden" name="type" value="2" />
										<input type="hidden" name="id" value="{$_GET['id']}" />
										<input type="submit" class="fl button bg-sub ajax_return" value="提交申请">
									</div>
								</div>
							</form>
						</div>
					</div>
					<div class="padding-big-left padding-big-right padding-big-bottom">
						<p>售后说明：<span class="text-mix">每个商品&订单您只有一次售后维权的机会</span></p>
						<p>1. <b>退货退款</b></p>
						<p>申请条件：若为商品问题，或者不想要了且与卖家达成一致退货，请选择“退货退款”选项，退货后请保留物流底单。</p>
						<p class="text-sub">退货流程：1.申请退货 >2.卖家发送退货地址给买家 >3.买家退货并填写退货物流信息 >4.卖家确认收货，退款成功</p>
						<p>2. <b>仅退款</b></p>
						<p>申请条件：若您未收到货，或已收到货且与卖家达成一致不退货仅退款时，请选择“仅退款”选项。</p>
						<p class="text-sub">退款流程：1.申请退款 > 2. 卖家同意退款申请>3.退款成功</p>
					</div>
				</div>
			</div>
		</div>
		{template footer common}
	</body>
</html>
<script>
	$(function(){
		var id = 'return';
		$(".tab-trigger .item").click(function(){
			$(".tabs-wrap").stop().animate({marginLeft:"-"+$(this).index()*928+"px"},100);
			id = $(this).data('id');
		})
		$('.ajax_return').bind('click',function(){
			var ajax_return = $("form[name=ajax_return]").Validform({
				showAllError:true,
				ajaxPost:true,
				callback:function(ret) {
					if(ret.status == 0) {
						$.tips({
							icon:'error',
							content:ret.message,
							callback:function() {
								return false;
							}
						});
					} else {
						$.tips({
							icon:'success',
							content:ret.message,
							callback:function() {
								window.location.reload();
							}
						});					
					}
				}
			})
		})
		
		var uploader = WebUploader.create({
        auto:true,
        fileNumLimit:10,
        fileVal:'upfile',
        // swf文件路径
        swf: '{__ROOT__}statics/js/upload/uploader.swf',
        // 文件接收服务端。
        server: "<?php echo url('attachment/index/upload')?>",
        // 选择文件的按钮。可选
        formData:{
            file : 'upfile',
            upload_init : '<?php echo $attachment_init ?>'
        },
        // 内部根据当前运行是创建，可能是input元素，也可能是flash.
        pick: {
            id: '#add_return',
            multiple:true
        },
        // 压缩图片大小
        compress:false,
        accept:{
            title: '图片文件',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/*'
        },
        chunked: false,
        chunkSize:1000000,
        resize: false
    })

    uploader.onUploadSuccess = function(file, response) {
    	if(response.status == 1) {
    		$('#add_return').parents('.ul_return').prepend('<li><a class="pic-center" href="'+ response.result.url +'" target="_blank"><img src="'+response.result.url+'"></a><input type="hidden" name="imgs[]" value="' + response.result.url + '"/><i class="pic-close text-center text-white">×</i></li>');
    	} else {
    		top.dialog({
				title: '消息提示',
				width: 300,
				content: '<div class="padding-large text-center">'+response.message+'</div>',
				okValue: '确定',
				ok: function(){
				},
				
			})
			.showModal();
    		return false;
    	}
    	$("li").hover(function(){
						$(".pic-close").eq($(this).index()).show();
					},function(){
						$(".pic-close").eq($(this).index()).hide();
					});
					$(".pic-close").click(function(){
						$(this).closest("li").remove();
					});
    }
		
		
	})
</script>